package com.cms.meeting.controller;

import com.cms.meeting.service.EmployeeService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 批准帐户
 * status=0为待批准
 * status=1为批准通过
 * status=2为批准未通过
 */
@Controller
@RequestMapping("/admin")
public class ApproveaccountController {

    @Autowired
    private EmployeeService employeeService;


    public static final Integer PENDING_APPROVE = 0;


    @RequestMapping("/approveaccount")
    public String approveaccount(Model model) {
        model.addAttribute("emps", employeeService.getAllEmpsByStatus(PENDING_APPROVE));

        return "approveaccount";
    }

    @RequestMapping("/updatestatus")
    public String updatestatus(Integer employeeid, Integer status) {
        Integer result = employeeService.updatestatus(employeeid, status);

        return "redirect:/admin/approveaccount";
    }
}
